package youxiao.bytezon;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;

//for jsr310 java 8 java.time.*
@EntityScan(basePackageClasses = { WebApplication.class, Jsr310JpaConverters.class })

@SpringBootApplication
public class WebApplication {

	private static Class<WebApplication> applicationClass = WebApplication.class;

	public static void main(String[] args) throws Exception {
		SpringApplication.run(applicationClass, args);
	}

	@Bean
	public Jackson2ObjectMapperBuilder jacksonBuilder() {
		Jackson2ObjectMapperBuilder b = new Jackson2ObjectMapperBuilder();
		b.propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
		return b;
	}

}